# Packages used for the Final Project
library(countrycode)
library(tidyverse)
## ── Attaching packages ───────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.3.0
## ✔ tibble 2.0.1 ✔ dplyr 0.8.0.1
## ✔ tidyr 0.8.2 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.3.0
## ── Conflicts ──────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(readxl)
library(maps)
##
## Attaching package: 'maps'
## The following object is masked from 'package:purrr':
##
## map
library(RColorBrewer)
library(viridis)
## Loading required package: viridisLite
library(rworldmap)
## Loading required package: sp
## ### Welcome to rworldmap ###
## For a short introduction type : vignette('rworldmap')
library(maptools)
## Checking rgeos availability: TRUE
library(dplyr)
library(ggplot2)
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(gifski)
library(gganimate)
#Datasets used for the Final Project
Current_USD <- read_excel('Military_Expenditure_Data.xlsx', sheet = 'Current USD') #Sipri Dataset
Share_of_GDP <- read_excel('Military_Expenditure_Data.xlsx', sheet = 'Share of GDP', skip = 5) #Sipri Dataset
Arms_Import <- read_excel('Arms_Imported.xlsx', sheet = "Data", skip = 3) #WorldBank Dataset obtained from Sipri
Military_Personal <- read_excel('Armed_Forces_Personel.xlsx', sheet = 'Data', skip = 3) #WorldBank Dataset obtained from Sipri
GlobalFirePower <- read_excel('GlobalFirePower.xlsx', sheet = 'GlobalFirePower')
#Cleaning of Datasets
#Gathering columns and mutating values to numeric
# Datasets messy formats were all similar
Current_USD <- Current_USD %>% gather(Year, Value, -Country, -Notes) %>% mutate(Value = as.numeric(Value), Year = as.numeric(Year)) %>% filter(!is.na(Value)) %>% mutate(Value = Value)
## Warning: NAs introduced by coercion
Share_of_GDP <- Share_of_GDP %>% gather(Year, Value, -Country, -Notes) %>% mutate(Value = as.numeric(Value), Year = as.numeric(Year)) %>% filter(!is.na(Value))
## Warning: NAs introduced by coercion
Arms_Import <- Arms_Import %>% gather(Year, Value, -`Country Name`, -`Country Code`) %>% mutate(Value = as.numeric(Value), Year = as.numeric(Year)) %>% rename(Country = `Country Name`, iso3c = `Country Code`) %>% filter(!is.na(Value))
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
Military_Personal <- Military_Personal %>% gather(Year, Value, -`Country Name`, -`Country Code`) %>% mutate(Value = as.numeric(Value), Year = as.numeric(Year)) %>% rename(Country = `Country Name`, iso3c = `Country Code`) %>% filter(!is.na(Value))
## Warning: NAs introduced by coercion
## Warning: NAs introduced by coercion
#Adding missing countries and country codes
Current_USD <- Current_USD %>% mutate(iso3c = countrycode(Country, "country.name", destination = "iso3c")) %>% mutate(iso3c = ifelse(Country == "Kosovo", "KOS", iso3c))
## Warning in countrycode(Country, "country.name", destination = "iso3c"): Some values were not matched unambiguously: Central African Rep., Czechoslovakia, Kosovo
Current_USD[Current_USD$Country == "Central African Rep.", "iso3c"] <- "CAF"
Current_USD[Current_USD$Country == "South Sudan", "iso3c"] <- "SSD"
Share_of_GDP <- Share_of_GDP %>% mutate(iso3c = countrycode(Country, "country.name", destination = "iso3c")) %>% mutate(iso3c = ifelse(Country == "Kosovo", "KOS", iso3c))
## Warning in countrycode(Country, "country.name", destination = "iso3c"): Some values were not matched unambiguously: Central African Rep., Kosovo
Share_of_GDP[Share_of_GDP$Country == "Central African Rep.", "iso3c"] <- "CAF" # Adding
#We are using a large GeoSpatialDataframe to Plot Countires and their information
#Libraries we will use for this
#Loading Geo_spatial Data Frame created @ https://geojson-maps.ash.ms/
library(broom)
library(geojsonio)
##
## Attaching package: 'geojsonio'
## The following object is masked from 'package:base':
##
## pretty
world_map <- geojsonio::geojson_read('custom.geo.json', what = 'sp')
world_map <- tidy(world_map, region = "sov_a3") # Changing from large spatial dataframe to regular data frame.
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): Unequal factor levels: coercing to character
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
## Warning in bind_rows_(x, .id): binding character and factor vector,
## coercing into character vector
world_map <- world_map %>% mutate(iso3c = id)
#Adding ISO
#Manual searched for incorrect country codes and fixed them to match
world_map[world_map$id == "US1", "iso3c"] <- "USA"
world_map[world_map$id == "CH1", "iso3c"] <- "CHN"
world_map[world_map$id == "AU1", "iso3c"] <- "AUS"
world_map[world_map$id == "DN1", "iso3c"] <- "DNK"
world_map[world_map$id == "FI1", "iso3c"] <- "FIN"
world_map[world_map$id == "FR1", "iso3c"] <- "FRA"
world_map[world_map$id == "GB1", "iso3c"] <- "GBR"
world_map[world_map$id == "NL1", "iso3c"] <- "NLD"
world_map[world_map$id == "NZ1", "iso3c"] <- "NZL"
world_map[world_map$id == "SDS", "iso3c"] <- "SSD"
world_map[world_map$id == "SOL", "iso3c"] <- "SOM"
world_map[world_map$id == "SAH", "iso3c"] <- "MAR"
#North Korea, The Bahamas, Bhutan, suriname are the only missing and not reported.
#Practice Plot
world_map %>% ggplot(aes(x = long, y = lat, group = group))+ geom_polygon()

#Statistical Plots
#We are going to do some exploratory Visualization
#Comparing top Militaries Spending
Current_USD %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("USA", "Russian Federation", "China, P.R.", "India", "France")) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country)) + ggtitle("Military Expenditure Country USD")+ xlab("Years")+ ylab("Current Prices")+scale_x_continuous(breaks = c(1992:2017))+ scale_y_continuous(breaks = c(0e+00, 2e+05, 4e+05, 6e+05), labels = c("Hundreds of Millions", "200 Billion", "400 Billion", "600 Billion"))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

Current_USD %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("USA", "Russian Federation", "China, P.R.", "India", "France")) %>% ggplot(aes(x = Year, y = log2(Value)))+ geom_line(aes(color = Country)) + ggtitle("Military Expenditure Country USD")+ xlab("Years")+ ylab("Current Prices Log2")+scale_x_continuous(breaks = c(1992:2017))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

#Comparing weak military Spending
Current_USD %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country)) + ggtitle("Military Expenditure(Weak) Country USD")+ xlab("Year")+ ylab("Current Prices")+scale_x_continuous(breaks = c(1992:2017))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))+ scale_y_continuous(breaks = c(0, 500, 1000, 1500), labels = c("10s of Millions", "500 Million", "1 Billion", "1.5 Billion"))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

Current_USD %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% ggplot(aes(x = Year, y = log2(Value)))+ geom_line(aes(color = Country)) + ggtitle("Military Expenditure(Weak) Country USD")+ xlab("Year")+ ylab("Current Prices Log2")+scale_x_continuous(breaks = c(1992:2017))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

#------------------------------------------------------------------------#
#Comparing top Militaries Spending based on GDP
Share_of_GDP %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("USA", "Russian Federation", "China, P.R.", "India", "France")) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+ ggtitle("Military Expenditure as % of GDP")+ xlab("Year")+ ylab("Military Expenditure")+ scale_y_continuous(labels = scales::percent)+scale_x_continuous(breaks = c(1992:2017))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

#Comparing weak Militaries Spending based on GDP
Share_of_GDP %>% group_by(Country, iso3c, Year, Value) %>% filter(Year >= 1992) %>% filter(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+ ggtitle("Military Expenditure as % of GDP")+ xlab("Year")+ ylab("Military Expenditure")+ scale_y_continuous(labels = scales::percent)+scale_x_continuous(breaks = c(1992:2017))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

#------------------------------------------------------------------------#
#Comparing Top Countries Military Personal
Military_Personal %>% subset(Country %in% c("United States", "Russian Federation", "China", "India", "France")) %>% filter(Year >= 1992) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+scale_x_continuous(breaks = c(1992:2016))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))+ggtitle("Military Personal % of Labor Force")+ xlab("Years")+ ylab("Military Personal")

#Comparing Weak Countries Military Personal
Military_Personal %>% subset(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% filter(Year >= 1992) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+scale_x_continuous(breaks = c(1992:2016))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))+ggtitle("Military Expenditure as % Labor Force")+ xlab("Years")+ ylab("Military Personal")

#------------------------------------------------------------------------#
#Comparing top Militaries Arm imports
Arms_Import %>% subset(Country %in% c("United States", "Russian Federation", "China", "India", "France")) %>% filter(Year >= 1992) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+ ggtitle("Military Arms Import")+ xlab("Year")+ ylab("Military Arms")+scale_x_continuous(breaks = c(1992:2016))+ scale_y_continuous(breaks = c(2.000e+06, 1.029e+09, 2.500e+09, 5.322e+09), labels = c("2 Million", "1 Billion", "2.5 Billion", "5 Billion"))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1)) #Number of Arm imports for each powerful Country

#Comparing Weak Militaries Arm imports
Arms_Import %>% subset(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% filter(Year >= 1992) %>% ggplot(aes(x = Year, y = Value))+ geom_line(aes(color = Country))+ ggtitle("Military Arms Import")+ xlab("Year")+ ylab("Military Arms")+scale_x_continuous(breaks = c(1992:2016))+ scale_y_continuous(breaks = c(2.000e+06, 15.000e+06, 38.000e+06, 76.000e+06), labels = c("2 Million", "15 Million", "38 Million", "76 Million"))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1)) #Number of Arm imports for each powerful Country

#------------------------------------------------------------------------#
#Countries Military Arsenals for Year 2017
#Statistic
GlobalFirePower_X<- GlobalFirePower %>% select(Country, ISO3, `Total Aircraft Strength`, `Total Helicopter Strength`, `Combat Tanks`, 19, 20, 23)
GlobalFirePower_X %>% filter(Country %in% c("United States", "Russia", "China", "India", "France")) %>% summary()
## Country ISO3 Total Aircraft Strength
## Length:5 Length:5 Min. : 1305
## Class :character Class :character 1st Qu.: 2102
## Mode :character Mode :character Median : 2955
## Mean : 4784
## 3rd Qu.: 3794
## Max. :13762
## Total Helicopter Strength Combat Tanks Armored Fighting Vehicles
## Min. : 610 Min. : 406 Min. : 4788
## 1st Qu.: 666 1st Qu.: 4426 1st Qu.: 6704
## Median : 912 Median : 5884 Median : 6863
## Mean :1928 Mean : 7478 Mean :18143
## 3rd Qu.:1389 3rd Qu.: 6457 3rd Qu.:31298
## Max. :6065 Max. :20216 Max. :41062
## Self-Propelled Artillery Total Naval Assets
## Min. : 290 Min. :118.0
## 1st Qu.: 325 1st Qu.:295.0
## Median :1710 Median :352.0
## Mean :2046 Mean :378.8
## 3rd Qu.:1934 3rd Qu.:415.0
## Max. :5972 Max. :714.0
GlobalFirePower_X %>% filter(Country %in% c("Ireland", "Sierra Leone", "Ghana", "Latvia", "Estonia")) %>% summary()
## Country ISO3 Total Aircraft Strength
## Length:4 Length:4 Min. : 4.00
## Class :character Class :character 1st Qu.: 4.75
## Mode :character Mode :character Median : 5.50
## Mean :10.00
## 3rd Qu.:10.75
## Max. :25.00
## Total Helicopter Strength Combat Tanks Armored Fighting Vehicles
## Min. : 4.00 Min. :0.0 Min. : 10.0
## 1st Qu.: 4.00 1st Qu.:0.0 1st Qu.:190.0
## Median : 4.50 Median :0.0 Median :275.0
## Mean : 6.75 Mean :0.5 Mean :219.5
## 3rd Qu.: 7.25 3rd Qu.:0.5 3rd Qu.:304.5
## Max. :14.00 Max. :2.0 Max. :318.0
## Self-Propelled Artillery Total Naval Assets
## Min. :0 Min. : 6.0
## 1st Qu.:0 1st Qu.: 9.0
## Median :0 Median :14.0
## Mean :0 Mean :13.5
## 3rd Qu.:0 3rd Qu.:18.5
## Max. :0 Max. :20.0
#Mexico Information
Current_USD %>% group_by(Country, iso3c, Year, Value) %>% filter(Country == "Mexico") %>% filter(Year >= 1970) %>% ggplot(aes(x = Year, y = Value))+ geom_point()+ geom_line()+ ggtitle("Mexico's Military Expenditure")+ xlab("Year")+ ylab("Current Prices")+ scale_y_continuous(breaks = c(0, 2500, 5000, 7500), labels = c("Hundreds of Millions", "2.5 Billion", "5 Billion", "7.5 Billion"))

#-----------------------------------------------------------------------------------------------------#
Share_of_GDP %>% group_by(Country, iso3c, Year, Value) %>% filter(Country == "Mexico") %>% filter(Year >= 1970) %>% ggplot(aes(x = Year, y = Value * 100))+ geom_point()+ geom_line()+ ggtitle("Mexico's Military Expenditure as % of GDP")+ xlab("Year")+ ylab("Percent of GDP")+scale_y_continuous(breaks = c(.400, .500, .600, .700), labels = c("4%", "5%", "6%", "7%"))

#-----------------------------------------------------------------------------------------------------#
Military_Personal %>% filter(Country == "Mexico") %>% filter(Year >= 1970) %>% ggplot(aes(x = Year, y = Value))+ geom_point()+ geom_line()+
ggtitle("Mexico's Military Personal as % of Labor Force")+ xlab("Year")+ ylab("Military Personal")+ scale_y_continuous(breaks = c(.45, .50, .55, .60, .65), labels = c(".45%", ".50%", ".55%", ".60%", ".65%"))# Really good graph show mexicos military increase as a percent of labor force

#-----------------------------------------------------------------------------------------------------#
Arms_Import %>% filter(Country == "Mexico") %>% filter(Year >= 1970) %>% ggplot(aes(x = Year, y = Value))+ geom_point()+ geom_line()+
ggtitle("Mexico's Military Arms Import")+ xlab("Year")+ ylab("Military Arms")+ scale_y_continuous(breaks = c(0e+00, 1e+08, 2e+08, 3e+08, 4e+08, 5e+08), labels = c("6 Million", "100 Million", "200 Million", "300 Million", "400 Million", "500 Million"))+ theme(axis.text.x = element_text(angle = 80, vjust = 1, hjust = 1))

#-----------------------------------------------------------------------------------------------------#
GlobalFirePower_X<- GlobalFirePower %>% select(Country, ISO3, `Total Aircraft Strength`, `Total Helicopter Strength`, `Combat Tanks`, 19, 20, 23)
GlobalFirePower_X %>% filter(Country == "Mexico")
## # A tibble: 1 x 8
## Country ISO3 `Total Aircraft… `Total Helicopt… `Combat Tanks`
## <chr> <chr> <dbl> <dbl> <dbl>
## 1 Mexico MEX 452 209 0
## # … with 3 more variables: `Armored Fighting Vehicles` <dbl>,
## # `Self-Propelled Artillery` <dbl>, `Total Naval Assets` <dbl>
#Current USD
data_for_map <- Current_USD %>% group_by(Country) %>% filter(Year == max(Year))
world_map_join <- world_map %>% left_join(data_for_map, by = "iso3c")
Flat_Map <- world_map_join %>% ggplot(aes(x = long, y = lat, group = group, fill = log(Value)))+
geom_polygon() + scale_fill_viridis(option = "inferno", direction = -1)
ggplotly(Flat_Map)
#______________________________________________________________________________#
data_for_map_gdp <- Share_of_GDP %>% group_by(Country) %>% filter(Year == max(Year))
world_map_join_gdp <- world_map %>% left_join(data_for_map_gdp, by = "iso3c")
Flat_Map_gdp <- world_map_join_gdp %>% ggplot(aes(x = long, y = lat, group = group, fill = Value))+
geom_polygon()+ scale_fill_viridis(option = "inferno", direction = -1)
ggplotly(Flat_Map_gdp)
#Current USD
Animation_Prep <- Current_USD %>% group_by(Country)
Animation_Prep_2 <- Share_of_GDP %>% group_by(Country)
Animation_Map <- world_map %>% left_join(Animation_Prep, by = "iso3c")
Animation_Map_2 <- world_map %>% left_join(Animation_Prep_2, by = "iso3c")
#Animation_Map <- na.omit(Animation_Map)
Animation <- ggplot() + geom_polygon(data = world_map, aes(x = long, y = lat, group = group))+
geom_polygon(data = Animation_Map, aes(x = long, y = lat, group = group, fill = log(Value)))+
scale_fill_distiller(palette = "BuGn", direction = 1 )+ theme_dark()+
transition_time(Year, range = c(2000, 2017)) + ease_aes('linear')
AnimationX <- ggplot() + geom_polygon(data = world_map, aes(x = long, y = lat, group = group))+
geom_polygon(data = Animation_Map_2, aes(x = long, y = lat, group = group, fill = log(Value)))+
scale_fill_distiller(palette = "BuGn", direction = 1 )+ theme_dark()+
transition_time(Year, range = c(1970, 2017)) + ease_aes('linear')
#animate(Animation)
#animate(Animation_2)